<?php
/**
 * Url
 * @filesource
 */
/**
 * Namespace
 */
namespace framework\helper;
/**
 * Dependencies
 */
/**
 * Url Class
 * 
 * @todo Finish up this class
 * @todo Finish Documentation
 * 
 * @author Randy Casburn <randy@plurious.com>
 * @copyright Copyright Plurious Software, all rights reserved
 * @license MIT
 * @license http://www.opensource.org/licenses/mit-license.html
 * @link http://plurious.com/framework/documentation/classes/Front.html
 * @version 2.1
 */
class Url {

    /**
     * Creates a well formed url
     * 
     * @param string $route must be in the form [context/]controller ('home') or ('web/home')
     * @param string $args must be in the form 'method=name&arg1=argument&arg2=argument&...'
     * @return string the properly formated url
     */
    public function link($route, $args = '', $seo = SEO) {
        $url = ROOT_URL;
        if ($seo !== true) {
            $url .= 'index.php?route=';
        } else {
            $url .= '';
        }
        $url .= $route;
        if ($args) {
            $parts = split('&', $args);
            foreach ($parts as $part) {
                $arg = split("=", $part);
                $url .= '/' . $arg[1];
            }
        }
        return $url;
    }

}

?>